<seed-content class="default-bg" #content>
  <seed-toolbar-header>
    <seed-toolbar-title>添加客户</seed-toolbar-title>
    <seed-toolbar-menu></seed-toolbar-menu>
  </seed-toolbar-header>
  <div class="seed-gap"></div>
  <form [formGroup]="signForm">

    <seed-form-input
      [placeholder]="'请输入真实姓名(必填)'"
      [title]="'姓名'"
      formControlName="name"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['name'].errors" >请填写真实姓名</p>
    </seed-form-input>

    <seed-form-input
      [type]="'tel'"
      [title]="'监护人手机'"
      [placeholder]="'监护人手机(必填)'"
      formControlName="parentMobile"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['parentMobile'].errors" >请输入有效的手机号</p>
    </seed-form-input>

    <seed-form-select-sex [placeHolder]="'请选择性别(必填)'"  formControlName="sex" ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['sex'].errors">请选择性别</p>
    </seed-form-select-sex>


    <seed-form-input
      [title]="'家庭住址'" [placeholder]="'家庭住址(必填)'"
      formControlName="address"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['address'].errors" >请填写学员家庭地址</p>
    </seed-form-input>


    <seed-form-select
      [arr]="schoolList" [title]="'咨询校区'" [placeHolder]="'请选择校区(必填)'"
      formControlName="advisorySchoolId"
      [optionsText]="'schoolName'" ngDefaultControl
      [optionsValue]="'id'" (valueChange)="selectSchool($event)">
    </seed-form-select>

    <seed-form-select
      [arr]="origineArr" [title]="'来源'" [placeHolder]="'请选择来源(必填)'"
      formControlName="origine"
      [optionsText]="'title'" ngDefaultControl
      [optionsValue]="'value'" (valueChange)="selectOrigin($event)">
    </seed-form-select>

    <seed-form-input
      [title]="'电子邮箱'"
      formControlName="email"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['email'].errors" >请填写真实姓名</p>
    </seed-form-input>

    <ng-container formGroupName="idNo">
      <seed-form-select
        (valueChange)="certificateChange($event)"
        [arr]="certificateArr"
        [title]="'证件类型'"
        [optionsText]="'title'"
        [optionsValue]="'value'"
        formControlName="certificate" [needBlur]="false"
        ngDefaultControl>
        <p class="error-tip" *ngIf="signForm.controls['idNo']['controls']['num'].value && !signForm.controls['idNo']['controls']['certificate'].value" >请选择证件类型</p>
      </seed-form-select>

      <seed-form-input
        [placeholder]="'请输入有效证件号'"
        [title]="'证件号'"
        formControlName="num"
        ngDefaultControl>
        <!--<p class="error-tip" *ngIf="signForm.hasError('invalidIdNum') || signForm.controls['idNo'].controls['num'].errors">请输入真实有效证件号</p>-->
        <p class="error-tip" *ngIf="signForm.hasError('invalidIdNum') || signForm.controls['idNo']['controls']['num'].errors">请输入真实有效证件号</p>
        <!--<p class="error-tip" *ngIf="signForm.hasError('invalidIdNum')" >请输入真实有效证件号</p>-->
      </seed-form-input>
    </ng-container>

    <seed-form-input
      [placeholder]="'请输入学员体重'"
      [type]="'tel'" [title]="'体重(KG)'"
      formControlName="weight"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['weight'].errors" >请输入学员真实体重</p>
    </seed-form-input>

    <seed-form-input
      [placeholder]="'请输入学员身高'"
      [type]="'tel'" [title]="'身高(CM)'"
      formControlName="height"
      ngDefaultControl>
      <p class="error-tip" *ngIf="signForm.controls['height'].errors" >请输入学员真实身高</p>
    </seed-form-input>


    <div class="seed-underline" (click)="showArea()">
      <label class="item seed-flexbox seed-flexbox-content-between">
        <span class="title" [class.has-change]="origin.hasChange">籍贯</span>
        <span class="place-holder">{{origin.text}}</span>
      </label>
    </div>
  </form>
  <seed-submit-button [btnText]="'确认'"  class="seed-scroll-outside"
                      [disabled]="signForm.invalid"
                      (submit)="sign()"></seed-submit-button>
</seed-content>
<seed-modal [content]="content" >
  <seed-regio-picker class="seed-modal-content" [tier]="2" (complete)="pickerFinish($event)"></seed-regio-picker>
</seed-modal>
